<!DOCTYPE html>
<!-- saved from url=(0052)http://www.swiper.com.cn/demo/22-dynamic-slides.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <title>Swiper demo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

    <!-- Link Swiper's CSS -->
    <link rel="stylesheet" href="./Swiper demo_files/swiper.min.css">

    <!-- Demo styles -->
    <style>
    body {
        background: #eee;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color:#000;
        margin: 0;
        padding: 0;
    }
    .swiper-container {
        width: 100%;
        height: 300px;
        margin: 20px auto;
    }
    .swiper-slide {
        text-align: center;
        font-size: 18px;
        background: #fff;
        
        /* Center slide text vertically */
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
    }
    .append-buttons {
        text-align: center;
        margin-top: 20px;
    }
    .append-buttons a {
        display: inline-block;
        border: 1px solid #007aff;
        color: #007aff;
        text-decoration: none;
        padding: 4px 10px;
        border-radius: 4px;
        margin: 0 10px;
        font-size: 13px;
    }
    </style>
</head>
<body>
    <!-- Swiper -->
    <div class="swiper-container swiper-container-horizontal">
        <div class="swiper-wrapper" style="transform: translate3d(434.667px, 0px, 0px); transition-duration: 0ms;"><div class="swiper-slide swiper-slide-active" style="width: 404.667px; margin-right: 30px;">Slide -2</div><div class="swiper-slide swiper-slide-next" style="width: 404.667px; margin-right: 30px;">Slide -1</div><div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 0</div>
            <div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 1</div>
            <div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 2</div>
            <div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 3</div>
            <div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 4</div>
        <div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 5</div><div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 6</div><div class="swiper-slide" style="width: 404.667px; margin-right: 30px;">Slide 7</div></div>
        <!-- Add Pagination -->
        <div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets"><span class="swiper-pagination-bullet swiper-pagination-bullet-active"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span><span class="swiper-pagination-bullet"></span></div>
        <!-- Add Arrows -->
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev swiper-button-disabled"></div>
    </div>
    <p class="append-buttons">
        <a href="http://www.swiper.com.cn/demo/22-dynamic-slides.html#" class="prepend-2-slides">Prepend 2 Slides</a>
        <a href="http://www.swiper.com.cn/demo/22-dynamic-slides.html#" class="prepend-slide">Prepend Slide</a>
        <a href="http://www.swiper.com.cn/demo/22-dynamic-slides.html#" class="append-slide">Append Slide</a>
        <a href="http://www.swiper.com.cn/demo/22-dynamic-slides.html#" class="append-2-slides">Append 2 Slides</a>
    </p>
    <!-- Swiper JS -->
    <script src="./Swiper demo_files/swiper.min.js"></script>

    <!-- Initialize Swiper -->
    <script>
    var appendNumber = 4;
    var prependNumber = 1;
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        slidesPerView: 3,
        centeredSlides: true,
        paginationClickable: true,
        spaceBetween: 30,
    });
    document.querySelector('.prepend-2-slides').addEventListener('click', function (e) {
        e.preventDefault();
        swiper.prependSlide([
            '<div class="swiper-slide">Slide ' + (--prependNumber) + '</div>',
            '<div class="swiper-slide">Slide ' + (--prependNumber) + '</div>'
        ]);
    });
    document.querySelector('.prepend-slide').addEventListener('click', function (e) {
        e.preventDefault();
        swiper.prependSlide('<div class="swiper-slide">Slide ' + (--prependNumber) + '</div>');
    });
    document.querySelector('.append-slide').addEventListener('click', function (e) {
        e.preventDefault();
        swiper.appendSlide('<div class="swiper-slide">Slide ' + (++appendNumber) + '</div>');
    });
    document.querySelector('.append-2-slides').addEventListener('click', function (e) {
        e.preventDefault();
        swiper.appendSlide([
            '<div class="swiper-slide">Slide ' + (++appendNumber) + '</div>',
            '<div class="swiper-slide">Slide ' + (++appendNumber) + '</div>'
        ]);
    });
    </script>

</body></html>